package com.yugao.fintech.libra.shortlink.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yugao.fintech.framework.core.annotations.FieldUnique;
import com.yugao.fintech.framework.core.annotations.FieldUniqueConfig;
import com.yugao.fintech.framework.core.enums.SqlConditionTypeEnum;
import com.yugao.fintech.libra.common.BasePlusPO;
import com.yugao.fintech.libra.common.tenant.core.DataIsolation;
import lombok.Getter;
import lombok.Setter;

/**
 * 短链组
 */
@Getter
@Setter
@TableName("sl_link_group")
@DataIsolation(filterTenant = true, tableName = "sl_link_group")
@FieldUniqueConfig(sqlCondition = SqlConditionTypeEnum.OR)
public class LinkGroup extends BasePlusPO {
    @TableId
    private Long id;

    /**
     * 组名
     */
    @FieldUnique(message = "短链组已存在")
    private String name;

    /**
     * 关联的用户id
     */
    private Long userId;

    public static LambdaUpdateWrapper<LinkGroup> luw() {
        return Wrappers.lambdaUpdate();
    }

    public static LambdaQueryWrapper<LinkGroup> lqw() {
        return Wrappers.lambdaQuery();
    }
}
